package com.lh.customer;

import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @author hy
 * @description 使用注解的方式创建dubbo项目--客户端
 * @date 2019-10-07
 */
public class Customer {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConsumerConfiguration.class);
        CustomerComponent customer = context.getBean(CustomerComponent.class);
        String say = customer.demoService.hello("World");
        System.out.println(say);
    }

    @Configuration
    @PropertySource("classpath:/dubbo-customer.properties")
    @ComponentScan(basePackages = "com.lh.customer")
    @EnableDubbo
    static class ConsumerConfiguration {

    }
}



